<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>推荐使用备件详细信息</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../../../css/mui.min.css">
		<link rel="stylesheet" href="../../../css/global.css">
		<link rel="stylesheet" href="../../../css/style.css">
		<link rel="stylesheet" href="../../../css/task.css">
		<style type="text/css">
			.item_box .item{
				overflow: auto;
			}
			.item_box .item .bar{
				height: auto;
			}
			.item_box .item .bar .number{
				word-break: break-all;
			}
			.item_box .item .text{
				height: auto;
			}
			.item_box .item .text span{
				width: auto;
				word-break: break-all;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">推荐使用备件详细信息</h1>
		</header>
		<div class="mui-content">
			<div class="item_box" id="beijian">
				<!-- <div class="item" onclick="app.jumpTo('../service/fwtzbjxx.html','view/service/details.html')">
					<p class="bar">
						<span class="number">备件名称：117000111700011170001117000111700011170001117000111700011170001117000111700011170001</span>
					</p>
					<div class="text"><span>备件号：21323454657682132345465768213234546576821323454657682132345465768</span></div>
					<div class="text"><span>数量：1</span></div>
				</div>	 -->
			</div>
		</div>

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->

		<script type="text/javascript" charset="utf-8">
			(function($, doc) {
				$.init();

				var ServiceNoticeId
				var serviceNo
				
				$.plusReady(function() {
					
					// 从上一个页面取值
					var self = plus.webview.currentWebview();
					 // 获取上一个页面传过来的参数并显示到页面
					 ServiceNoticeId = self.ServiceNoticeId;
					 serviceNo = self.serviceNo;
					 
					 console.log("ServiceNoticeId:"+ServiceNoticeId+"	serviceNo:"+serviceNo)
					 
					 // 获取详情的方法
					 getDetails();
					 
					 
				});
				
				// 获取详情的方法
				function getDetails(){
					var recommendData = []; //推荐备件信息，将存入备件申请的缓存中
					ajaxGet(BASE_URL + "cc/ServicePart/getServicePart", {
						"ServiceNoticeId": ServiceNoticeId
					}, function(data) {
						if (data.code == 200) {
							h("#beijian").html("");
							var html = "";
							if (data.data && data.data.length > 0) {
								for(var i=0;i<data.data.length;i++){
									
									var das = data.data[i];
									var partName = das.partName==undefined?"无":das.partName;
									var partNo = das.partNo==undefined?"无":das.partNo;
									var qty = das.qty==undefined?"无":das.qty;
									var serviceNo = das.serviceNo==undefined?"":das.serviceNo;
									html += '<div class="item">'
									html += '<p class="bar"><span class="number">备件名称：'+partName+'</span></p>'
									html += '<div class="text"><span>备件号：'+partNo+'</span></div>'
									html += '<div class="text"><span>数量：'+qty+'</span></div>'
									html += '</div>';
									
									// 推荐备件所需字段
									var info = {
										"Part_no":partNo,
										"Part_name":partName,
										"Part_qty":qty,
										"serviceNo":serviceNo
									};
									recommendData.push(info);
								}
								h("#beijian").html(html);
							}else{
								var html = '<div class="nodata">—— 暂无数据 ——</div>';
								h("#beijian").html(html);
							}
						} else {
							var html = '<div class="nodata">—— 暂无数据 ——</div>';
							h("#beijian").html(html);
							app.toast(data.msg);
						}
					}, function(errorMsg) {
						var html = '<div class="nodata">—— 暂无数据 ——</div>';
						h("#beijian").html(html);
						app.toast("数据获取失败，请检查网络连接");	
					});
				}
				
			}(mui, document));
		</script>
		<!-- js代码 end -->

	</body>

</html>
